"""
file: conftest.py
Author: 城下秋草
Date: 2024/12/29
Desc: fixture的公共配置脚本
"""
import pytest
from playwright.sync_api import sync_playwright

@pytest.fixture(scope="session")
def page():
    try:
        print("\r\n----------开始测试----------")
        playwright = sync_playwright().start()
        browser = playwright.chromium.launch(
            headless=False,
            slow_mo=500,
            args=["--window-position=1024,-850"]
        )
        context=browser.new_context()
        page = context.new_page()
        yield page
    finally:
        page.close()
        context.close()
        browser.close()
        playwright.stop()
        print("\r\n----------完成测试----------")